//
// Created by liwan on 11/5/22.
//

#ifndef WEBSERVICE_WEBSERVICE_LIBEVENT_H
#define WEBSERVICE_WEBSERVICE_LIBEVENT_H

//通过libevent编写的web服务器
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <event.h>
#include <event2/listener.h>
#include <dirent.h>

#include "./pub.h"
#include "./webservice_epoll.h"


void EventMain();

int copy_header(struct bufferevent *bev, int op, char *msg, char *filetype, long filesize);

int copy_file(struct bufferevent *bev, const char *strFile);

int send_dir(struct bufferevent *bev, const char *strPath);

int http_request(struct bufferevent *bev, char *path);

void read_cb(struct bufferevent *bev, void *ctx);

void bevent_cb(struct bufferevent *bev, short what, void *ctx);

void listen_cb(struct evconnlistener *listener, evutil_socket_t fd, struct sockaddr *addr, int socklen, void *arg);


#endif //WEBSERVICE_WEBSERVICE_LIBEVENT_H
